package com.tao.system.test;


import com.alibaba.nacos.api.model.v2.Result;
import com.tao.common.redis.service.RedisService;
import com.tao.system.domain.sysUser.dot.ValidationDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/test")
@RestController
public class testController {

    @Autowired
    private RedisService redisService;

    @RequestMapping("/redisTest")
    public String redisTest() {
        redisService.setCacheObject("userId", "123456L");
        String userId = redisService.getCacheObject("userId", String.class);
        Boolean hasKey = redisService.hasKey("userId");
        System.out.println("hasKey: " + hasKey);
        return userId;
    }
    @RequestMapping("/demo01")
    public String demo01() {
        throw new RuntimeException();
//        return "拦截器测试成功";
    }

    @RequestMapping("/")
    public Result<String> validation(@Validated ValidationDTO validationDTO) {
        return Result.success();
    }


}
